﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Converter.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="TestItemListBoxItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="IsSelected" Value="{Binding Tag.IsReadyToTest, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <StackPanel x:Name="TestItemContainerStackPanel" Orientation="Horizontal" Margin="0,0,20,20">
                        <StackPanel.ToolTip>
                            <Label Width="140" Height="30" Content="{Binding Tag.TestItemTitle, RelativeSource={RelativeSource TemplatedParent}}" 
                                   HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20" />
                        </StackPanel.ToolTip>
                        <Image x:Name="ArrowRightImage" Visibility="Hidden" Source="/Skins/Resource/Image/ArrowHead-Right.png" Width="64" />
                        <Border x:Name="TestItemContainerBorder" BorderThickness="1" BorderBrush="Black" 
                                Background="#6ac239" Width="400" Height="90" CornerRadius="4" Padding="5">
                            <StackPanel Orientation="Horizontal" Margin="3,0,0,0">
                                <Image x:Name="TestItemImage" Height="78" 
                                       Source="{Binding Tag.TestItemName, RelativeSource={RelativeSource TemplatedParent}, 
                                        Converter={StaticResource TestItemDarkImageSourceConverter}}" />
                                <Border Margin="5,0,10,0" Width="300" Height="72" CornerRadius="4" 
                                        Background="#868788" BorderThickness="1" BorderBrush="Black">
                                    <TextBlock x:Name="TestResultTextBlock" FontSize="42" 
                                           Padding="15,10,0,0" Foreground="White" 
                                           Text="{Binding Tag.FormattedTestResult, RelativeSource={RelativeSource TemplatedParent}}" 
                                           Tag="{Binding Tag.IsSelected, RelativeSource={RelativeSource TemplatedParent}}" />
                                </Border>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="TestItemContainerBorder" Property="Background" Value="#919292" />
                            <Setter TargetName="ArrowRightImage" Property="Visibility" Value="Visible" />
                            <Setter TargetName="TestItemImage" Property="Source" 
                                    Value="{Binding Tag.TestItemName, RelativeSource={RelativeSource TemplatedParent}, 
                                    Converter={StaticResource TestItemBrightImageSourceConverter}}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="TestItemContainerBorder" Property="Background" Value="#919292" />
                            <Setter TargetName="TestItemImage" Property="Source" 
                                    Value="{Binding Tag.TestItemName, RelativeSource={RelativeSource TemplatedParent}, 
                                    Converter={StaticResource TestItemBrightImageSourceConverter}}" />
                        </Trigger>
                        <DataTrigger Binding="{Binding Text, ElementName=TestResultTextBlock}" Value="">
                            <Setter TargetName="TestItemContainerBorder" Property="Background" Value="#c5c5c5" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Tag, ElementName=TestResultTextBlock}" Value="False">
                            <Setter TargetName="TestItemContainerStackPanel" Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="FontSize" Value="18" />
        <Setter Property="Margin" Value="5,2,5,0" />
    </Style>
</ResourceDictionary>